<template>
  <el-form
    :inline="true"
    :model="formInline"
    style="display:flex; justify-content: space-between;"
  >
    <el-form-item>
      <el-button type="primary" icon="el-icon-edit" @click="showDialog('add')">{{ addTitle }}</el-button>
    </el-form-item>
    <div style="">
      <el-form-item>
        <el-select
          v-model="formInline.status"
          placeholder="商品状态"
          style="width: 110px"
        >
          <el-option label="已下架" value="0"></el-option>
          <el-option label="已上架" value="1"></el-option>
        </el-select> </el-form-item
      ><el-form-item>
        <el-input v-model="formInline.title" placeholder="标题"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="searchSubmit"
          >搜索</el-button
        >
      </el-form-item>
    </div>
  </el-form>
</template>

<script>
export default {
  props: {
    addTitle: {
      type: String,
      default: () => {
        return "";
      }
    }
  },
  data() {
    return {
      formInline: {
        status: "",
        title: ""
      }
    };
  },
  methods: {
    // 搜索
    searchSubmit() {
      this.$emit("searchSubmit", this.formInline);
    },
    // 添加
    showDialog(flag){
      this.$emit('showDialog', flag)
    }
  }
};
</script>

<style scoped></style>
